package com.springlearn.zhoufei.other.spring.demo4;

import org.aspectj.lang.annotation.*;

//切面
@Aspect
public class HelloAOP2_ASPECT {

    //方法规则式拦截
    @Pointcut("execution(* com.springlearn.zhoufei.other.spring.demo4.*.*(..))")
    private void pointcut1() {
    }
    
    @Before("pointcut1()")
    public void beforeAdvice() {
        System.out.println("beforeAdvice");
    }
    
    @After("pointcut1()")
    public void afterAdvice() {
        System.out.println("afterAdvice");
    }
    
    @AfterReturning(pointcut = "pointcut1()", returning = "retVal")
    public void afterReturningAdvice(Object retVal) {
        System.out.println("afterReturningAdvice:" + retVal);
    }
    
    @AfterThrowing(pointcut = "pointcut1()", throwing = "ex")
    public void AfterThrowingAdvice(IllegalArgumentException ex) {
        System.out.println("AfterThrowingAdvice");
    }
}